import { http } from "@/utils/http";

export const getGlobalServiceTypes = () => {
  return http.request<any>("get", "/api/global-config/service-types");
};

export const getUserServiceTypes = () => {
  return http.request<any>("get", "/api/global-config/user-services");
};

export const getGlobalCountries = () => {
  return http.request<any>("get", "/api/global-config/countries");
};

/** 获取系统支持的搜索选项（任务状态、服务类型、国家等） */
export const getSearchOptions = () => {
  return http.request<any>("get", "/api/global-config/search-options");
};

/** 通过服务类型代码获取对应的图标文件 */
export const getServiceIcon = (code: string) => {
  return http.request<any>("get", `/api/global-config/service-icon/${code}`, {
    responseType: "blob",
    hideMessage: true
  });
};
// 查询USDT实时汇率(usdCny)
export const getUsdtCnyExchangeRate = () => {
  return http.request<any>("get", "/api/global-config/exchange-rate/usdt-cny");
};

// 获取帮助手册
export const getGlobalManual = () => {
  return http.request<any>("get", "/api/global-config/manual", {
    responseType: "blob",
    hideMessage: true
  });
};

// 上传帮助手册
export const uploadGlobalManual = (formData: FormData) => {
  return http.request<any>("post", "/api/manual/upload", {
    data: formData,
    headers: { "Content-Type": "multipart/form-data" }
  });
};
